package com.woniuxy.cloud.carl.user.client;

import com.woniuxy.cloud.carl.user.client.param.AddAddressParam;
import com.woniuxy.cloud.carl.user.client.result.AddressDto;
import com.woniuxy.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@FeignClient(contextId = "AddressClient",name="user")
public interface AddressClient {
    @PostMapping("/addNewAddress")
    public Result addNewAddress(@RequestBody AddAddressParam param);

    @GetMapping({"/findAll"})
    public Result<List<AddressDto>> findAll(@RequestParam("userId")Integer userId);
    @GetMapping({"/lookDefault"})
    public Result<AddressDto> lookDefault(@RequestParam("userId")Integer userId);

    @GetMapping({"/setDefault"})
    public Result setDefault(@RequestParam("addressId")Long addressId);

    @GetMapping({"/deleteAdddress/{addressId}"})
    public Result deleteAdddress(@PathVariable("addressId")Long addressId);

    @GetMapping({"/findDefaultAddress"})
    public Result<AddressDto> findDefaultAddress(Long userId);
}
